using System;
using System.Collections;
using System.Windows.Forms;
using System.Collections.Generic;
using Microsoft.MediaCenter.Hosting;
using Microsoft.MediaCenter.UI;

namespace McePicasa
{
    public class McePicasaAddIn : IAddInModule, IAddInEntryPoint
    {
        //
        // Initialize (IAddInModule)
        //

        public void Initialize(Dictionary<string, object> appInfo, Dictionary<string, object> entryPointInfo)
        {
        }


        //
        // Uninitialize (IAddInModule)
        //

        public void Uninitialize()
        {
        }


        //
        // Launch (IAddInModule)
        //

        public void Launch(AddInHost host)
        {
            try
            {
                s_session = new HistoryOrientedPageSession();
                Application app = new Application(s_session, host);

                // Set the background color
                // Matches Background.C from Syles.mcml
                host.MediaCenterEnvironment.BackgroundColor = System.Drawing.Color.FromArgb(21, 35, 39);

                // Navigate to the main menu.
                app.GoToStartPage();
            }
            catch (Exception e)
            {
                host.MediaCenterEnvironment.Dialog(e.Message + "\n" + e.StackTrace, "McePicasa",
                    Microsoft.MediaCenter.DialogButtons.Ok, 10, true);
                host.MediaCenterEnvironment.NavigateToPage(Microsoft.MediaCenter.PageId.MorePrograms, null);
                throw;
            }
        }

        private static HistoryOrientedPageSession s_session;
    }
}